<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>数据字典管理</title>
		<link rel="stylesheet" href="../../js/bower_components/bootstrap/dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="../../js/bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
		<link rel="stylesheet" href="../../js/bower_components/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css">
		<link rel="stylesheet" href="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.css">
		<link rel="stylesheet" href="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.css">

		<script src="../../js/bower_components/jquery/dist/jquery.min.js"></script>

		<script src="../../js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="../../js/bower_components/bootbox.min.js"></script>
		<script src="../../js/bower_components/bootstrap-select/js/bootstrap-select.js"></script>
		<script src="../../js/bower_components/bootstrap-switch/dist/js/bootstrap-switch.min.js"></script>
		<script src="../../js/bower_components/bootstrap-table/dist/bootstrap-table.min.js"></script>
		<script src="../../js/bower_components/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js"></script>

		<script src="../../js/bower_components/bootstrap-treeview/dist/bootstrap-treeview.min.js"></script>
		<script src="../../js/bower_components/jquery-form-validator/form-validator/jquery.form-validator.min.js"></script>
		<script src="../../js/bower_components/moment/min/moment-with-locales.min.js"></script>
		<script>
			$(function() {
				$("table").bootstrapTable({
					locale: 'zh-CN'
				});
				initDictType();
				createTable();
			});

			function createTable() {
				$("#tblResult").bootstrapTable('destroy');
				$("#tblResult").bootstrapTable({
					url: "sysDict.json",
					//method:'get',
					queryParams: "queryParams",
					pagination: true,
					sidePagination: 'true', //'server',
					striped: true, // 是否显示行间隔色
					singleSelect: false,
					clickToSelect: true,
					contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
					uniqueId: "value",
					pageSize: "5",
					pagination: true, // 是否分页
					sortable: true, // 是否启用排序
					onClickRow: function(row) {
						alert(row.value);
						gbid = row.value;
					},
					onCheck: function(row) {
						alert(row.bid);
					},
					columns: [{
						field: 'value',
						title: "<span class='glyphicon glyphicon-tags' /> 编码值",
						halign: 'center'
					}, {
						field: 'display',
						title: "显示值",
						halign: 'center'
					}, {
						field: 'typecode',
						title: "所属类别",
						halign: 'center'
					}, {
						field: 'desc',
						title: "备注信息",
						halign: 'center'
					}]
				});
			}

			function initDictType() {
				//$('#selDictType').empty();
				$.ajax({
					type: 'Get',
					url: 'sysDictType.json',
					dataType: "Json",
					success: function(data) {
						if (!data.flag) {
							$.each(data, function(i, n) {
								$('#selDictType').append(" <option value=\"" + n.tid + "\">" + n.tame + "</option>");
							})
							$('#selDictType').selectpicker('refresh');
						}
					}
				});
				option = new Option("全部", "-1");
				$('#selDictType').append(option);
				$('#selDictType').selectpicker("refresh");
				$('#selDictType').selectpicker("render");
			}
		</script>

	</head>

	<body>
		<div class="container-fluid">
			<div class="row col-md-10">
				<div id="divSearchForm" class="form-inline">
					<div class="form-group">
						<label class="control-label" for="tbxDisplay">字典项目：</label>
						<input class="form-control" type="text" id="tbxDisplay" />
					</div>
					<div class="form-group">
						<label class="control-label" for="selDictType">所属类别：</label>
						<select id="selDictType"></select>
					</div>
					<div class="form-group">
						<button type="button" id="btnSearch" class="btn btn-primary">
							<span class="glyphicon glyphicon-search" /> 检索Search
						</button>
					</div>
				</div>
			</div>
			<div class="row col-md-10" style="margin-top: 10px;">
				<table id="tblResult"></table>
			</div>
		</div>
	</body>

</html>